home *** CD-ROM | disk | FTP | other *** search
/ Chip 2007 January, February, March & April / Chip-Cover-CD-2007-02.iso / Pakiet bezpieczenstwa / mini Pentoo LiveCD 2006.1 / mpentoo-2006.1.iso / livecd.squashfs / usr / lib / mozilla-firefox / idl / nsIImageLoadingContent.idl < prev    next >
Text File  |  2006-05-08  |  7KB  |  178 lines

  1. /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
  2. /* ***** BEGIN LICENSE BLOCK *****
  3.  * Version: MPL 1.1/GPL 2.0/LGPL 2.1
  4.  *
  5.  * The contents of this file are subject to the Mozilla Public License
  6.  * Version 1.1 (the "License"); you may not use this file except in
  7.  * compliance with the License. You may obtain a copy of the License at
  8.  * http://www.mozilla.org/MPL/
  9.  *
  10.  * Software distributed under the License is distributed on an "AS IS" basis,
  11.  * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
  12.  * for the specific language governing rights and limitations under the
  13.  * License.
  14.  *
  15.  * The Original Code is mozilla.org code.
  16.  *
  17.  * The Initial Developer of the Original Code is 
  18.  * Boris Zbarsky <bzbarsky@mit.edu>.
  19.  * Portions created by the Initial Developer are Copyright (C) 2003
  20.  * the Initial Developer. All Rights Reserved.
  21.  *
  22.  * Contributor(s):
  23.  *
  24.  *
  25.  * Alternatively, the contents of this file may be used under the terms of
  26.  * either the GNU General Public License Version 2 or later (the "GPL"), or
  27.  * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
  28.  * in which case the provisions of the GPL or the LGPL are applicable instead
  29.  * of those above. If you wish to allow use of your version of this file only
  30.  * under the terms of either the GPL or the LGPL, and not to allow others to
  31.  * use your version of this file under the terms of the NPL, indicate your
  32.  * decision by deleting the provisions above and replace them with the notice
  33.  * and other provisions required by the GPL or the LGPL. If you do not delete
  34.  * the provisions above, a recipient may use your version of this file under
  35.  * the terms of any one of the NPL, the GPL or the LGPL.
  36.  *
  37.  * ***** END LICENSE BLOCK ***** */
  38.  
  39. #include "imgIDecoderObserver.idl"
  40.  
  41. interface imgIRequest;
  42. interface nsIChannel;
  43. interface nsIStreamListener;
  44. interface nsIURI;
  45.  
  46. /**
  47.  * This interface represents a content node that loads images.  The interface
  48.  * exists to allow getting information on the images that the content node
  49.  * loads and to allow registration of observers for the image loads.
  50.  *
  51.  * Implementors of this interface should handle all the mechanics of actually
  52.  * loading an image -- getting the URI, checking with content policies and
  53.  * the security manager to see whether loading the URI is allowed, performing
  54.  * the load, firing any DOM events as needed.
  55.  *
  56.  * An implementation of this interface may support the concepts of a
  57.  * "current" image and a "pending" image.  If it does, a request to change
  58.  * the currently loaded image will start a "pending" request which will
  59.  * become current only when the image is loaded.  It is the responsibility of
  60.  * observers to check which request they are getting notifications for.
  61.  *
  62.  * Observers added in mid-load will not get any notifications they
  63.  * missed.  We should NOT freeze this interface without considering
  64.  * this issue.  (It could be that the image status on imgIRequest is
  65.  * sufficient, when combined with the imageBlockingStatus information.)
  66.  *
  67.  * XXXbz Do not freeze without removing imageURIChanged!
  68.  */
  69.  
  70. [scriptable, uuid(da19c86d-08aa-421c-8c37-12ec2ba5a2c3)]
  71. interface nsIImageLoadingContent : imgIDecoderObserver
  72. {
  73.   /**
  74.    * Request types.  Image loading content nodes attempt to do atomic
  75.    * image changes when the image url is changed.  This means that
  76.    * when the url changes the new image load will start, but the old
  77.    * image will remain the "current" request until the new image is
  78.    * fully loaded.  At that point, the old "current" request will be
  79.    * discarded and the "pending" request will become "current".
  80.    */
  81.   const long UNKNOWN_REQUEST = -1;
  82.   const long CURRENT_REQUEST = 0;
  83.   const long PENDING_REQUEST = 1;
  84.  
  85.   /**
  86.    * loadingEnabled is used to enable and disable loading in
  87.    * situations where loading images is unwanted.  Note that enabling
  88.    * loading will *not* automatically trigger an image load.
  89.    */
  90.   attribute boolean loadingEnabled;
  91.  
  92.   /**
  93.    * Returns the image blocking status (@see nsIContentPolicy).  This
  94.    * will always be an nsIContentPolicy REJECT_* status for cases when
  95.    * the image was blocked.  This status always refers to the
  96.    * CURRENT_REQUEST load.
  97.    */
  98.   readonly attribute short imageBlockingStatus;
  99.  
  100.   /**
  101.    * Used to register an image decoder observer.  Typically, this will
  102.    * be a proxy for a frame that wants to paint the image.
  103.    * Notifications from ongoing image loads will be passed to all
  104.    * registered observers.  Notifications for all request types,
  105.    * current and pending, will be passed through.
  106.    *
  107.    * @param aObserver the observer to register
  108.    *
  109.    * @throws NS_ERROR_OUT_OF_MEMORY
  110.    */
  111.   void addObserver(in imgIDecoderObserver aObserver);
  112.  
  113.   /**
  114.    * Used to unregister an image decoder observer.
  115.    *
  116.    * @param aObserver the observer to unregister
  117.    */
  118.   void removeObserver(in imgIDecoderObserver aObserver);
  119.   
  120.   /**
  121.    * Accessor to get the image requests
  122.    *
  123.    * @param aRequestType a value saying which request is wanted
  124.    *
  125.    * @return the imgIRequest object (may be null, even when no error
  126.    * is thrown)
  127.    *
  128.    * @throws NS_ERROR_UNEXPECTED if the request type requested is not
  129.    * known
  130.    */
  131.   imgIRequest getRequest(in long aRequestType);
  132.  
  133.   /**
  134.    * Used to find out what type of request one is dealing with (eg
  135.    * which request got passed through to the imgIDecoderObserver
  136.    * interface of an observer)
  137.    *
  138.    * @param aRequest the request whose type we want to know
  139.    *
  140.    * @return an enum value saying what type this request is
  141.    *
  142.    * @throws NS_ERROR_UNEXPECTED if aRequest is not known
  143.    */
  144.   long getRequestType(in imgIRequest aRequest);
  145.  
  146.   /**
  147.    * Gets the URI of the current request, if available.
  148.    * Otherwise, returns the last URI that this content tried to load, or
  149.    * null if there haven't been any such attempts.
  150.    */
  151.   readonly attribute nsIURI currentURI;
  152.  
  153.   /**
  154.    * loadImageWithChannel allows data from an existing channel to be
  155.    * used as the image data for this content node.
  156.    *
  157.    * @param aChannel the channel that will deliver the data
  158.    *
  159.    * @return a stream listener to pump the image data into
  160.    *
  161.    * @see imgILoader::loadImageWithChannel
  162.    *
  163.    * @throws NS_ERROR_NULL_POINTER if aChannel is null
  164.    */
  165.   nsIStreamListener loadImageWithChannel(in nsIChannel aChannel);
  166.  
  167.   /**
  168.    * ImageURIChanged is called when the appropriate attributes (eg
  169.    * 'src' for <img> tags) change.  The string passed in is the new
  170.    * uri string.
  171.    */
  172.   // XXXbz The only reason this is not a protected method is that
  173.   // XXXbz <object> and <embed> do everything from frames, not content.
  174.   // XXXbz Once those are moved to content, this method should become
  175.   // XXXbz a protected method on nsImageLoadingContent!
  176.   [noscript] void imageURIChanged(in AString aNewURI);
  177. };
  178.